import React, {useEffect, useState} from 'react';
import {
  ScrollView,
  View,
  Text,
  TouchableOpacity,
  ActivityIndicator,
  FlatList,
  Image,
  TextInput,
} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import AreaView from '../../components/Layout/AreaView';
import SearchHeadIcon from '../../components/SearchHeadIcon';
// import QuesDetail from '../../components/QuesDetail';
import styles from './style';
import {getPaperlist} from '../../service/common';

const ExamList = () => {
  const navigation = useNavigation();
  const [couses, setCouses] = useState([]);
  useEffect(() => {
    navigation.setOptions({
      title: '考试',
      // headerRight: () => <SearchHeadIcon />,
    });
    getPaperlist({epScene: '02',epClazz:'01', epType: ""}).then((res) => {
      console.log(res);
      setCouses([...res.rows]);
    });
  }, [navigation]);
  
  return (
    <AreaView>
      <ScrollView style={styles.container}>
        {/* <TouchableOpacity  activeOpacity={1} style={styles.list}>
          <Text style={styles.title}>标题标题标题标题标题标题标题标题</Text>
          <Text style={styles.desc}>
            有句话说的好，颈椎不舒服，很多疾病都会随之找上门来，虽然这有一点夸大的成分，但是也从侧面说明了，颈椎对于人体真的很重要,追这方面不好，甚至很多器官。
          </Text>
        </TouchableOpacity> */}

        {(couses || []).map((item) => (
          <TouchableOpacity
            key={item.epId}
            onPress={() => {
              navigation.push('QuesDetail', {
                epId: item.epId,
              });
            }}
            style={styles.list}
          >
            <Text style={styles.title}>{item?.epTitle}</Text>
            <Text style={styles.desc}>
              {item?.epDesc}
            </Text>
          </TouchableOpacity>
        ))}
      </ScrollView>
    </AreaView>
  );
};

export default ExamList;
